<template>
	<view class="main" :style="{'backgroundImage': 'url('+componyInfo.background+')'}">
		<!-- <image class="bgc" :src="componyInfo.logo"></image> -->
		<view class="bottomBox">
			<view class="top">
				<image :src="componyInfo.logo" class="logo"></image>
				<view class="top_right">
					<view class="title">{{componyInfo.brand}}</view>
					<view class="jieshao">{{componyInfo.sale_info}}</view>
				</view>
			</view>
			<video v-if="componyInfo.video" :src="componyInfo.video" style="margin: auto;height: 325rpx;width: 90%;"  :title="componyInfo.brand"></video>
			<view class="center">
				{{componyInfo.companyProfile || ''}}
			</view>
			<view class="footer">
				<view class="phone foot-box" @click="callphone(componyInfo.telephone)">
					<u-icon name="phone" size="45" label="电话" label-pos="bottom"></u-icon>

				</view>
				<view>|</view>
				<view class="mp foot-box" @click="openWXImg">
					<u-icon name="chat" size="45" label="微信" label-pos="bottom"></u-icon>

				</view>
				<!-- <view>|</view>
				<view class="address foot-box" @click="openLocation">
					<u-icon name="map" size="45" label="地址" label-pos="bottom"></u-icon>

				</view> -->
			</view>
		</view>
		<view class="compony-ddress">
			<u-divider color="#fa3534">联系地址</u-divider>
			<view class="address" v-for="(ad,index) in componyInfo.address_info" :key="index" @click="openLocation(ad)">
				<u-image width="150rpx" height="150rpx" :src="ad.image"></u-image>
				<view class="address-name">
					{{ad.name}}
				</view>
			</view>
		</view>
		<u-mask :show="isMaskShow" @click="isMaskShow = false">
			<image :src="componyInfo.weixin_image" class="mask-image"
				show-menu-by-longpress="true"></image>
		</u-mask>
		<!-- <u-tabbar :list="tabbarList" :mid-button="true" active-color="#5199ff" height="120"></u-tabbar> -->
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex';
	export default {
		data() {
			return {
				isMaskShow: false,
				bgcImage: 'https://test.txjtapi.cn/uploads/images/shouye.jpg',
				indexInfo: {
					logo: '',
					brand: '泰新布业',
					saleInfo: '主营：针织面料、时装面料',
					companyProfile: '泰新布业位于中国广州市，泰新布业是一家针织面料、库存面料、服装批发等产品的经销批发的有限责任公司(自然人投资或控股)。泰新布业经营的针织面料、 库存面料、 服装批发畅销消费者市场。泰新布业的产品在消费者当中享有较高的地位，公司与多家零售商和代理商建立了长期稳定的合作关系。泰新布业经销的针织面料、 库存面料、 服装批发品种齐全、 价格合理。泰新布业实力雄厚， 重信用、 守合同、 保证产品质量， 以多品种经营特色和薄利多销的原则，赢得了广大客户的信任， 产品受到广大客户的青睐和喜爱.',
					telePhone: '13922345058',
					opemWxImage: '',
					openLocation: {
						latitude: 23.078083,
						longitude: 113.289468,
						name: '广州市泰新纺织有限公司',
						address: '广州市海珠区东晓南路680号广州衣创668泰新集团'
					}
				},
				adressInfo: [{
					image: '',
					latitude: 23.078083,
					longitude: 113.289468,
					name: '广州市泰新纺织有限公司',
					address: '广州市海珠区东晓南路680号广州衣创668泰新集团'
				}, {
					image: '',
					latitude: 23.078083,
					longitude: 113.289468,
					name: '广州市泰新纺织有限公司',
					address: '广州市海珠区东晓南路680号广州衣创668泰新集团'
				}]
			}
		},
		mounted() {
		this.$store.dispatch('getComponyInfo');
		},
		methods: {
			callphone(telephone) {
				uni.makePhoneCall({
					phoneNumber: telephone, //仅为示例
					success: function() {
						console.log('拨打电话成功')
					},
					fail: function() {
						console.log('拨打电话失败')
					}
				});
			},
			openWXImg() {
				this.isMaskShow = true;
			},
			openLocation(ad) {
				uni.openLocation({
					latitude: ad.latitude,
					longitude: ad.longitude,
					name: ad.name,
					/*这里填写位置名*/
					address: ad.address,
					/*位置名的详情说明*/
					success: function() {
						console.log('success');
					},
					fail: function(err) {
						console.log(err);
					}
				});
			},
			// 转发
			onShareAppMessage(){
				return{
					path:`/pages/aboutUs/aboutUs`,
				}
			},
			// 分享到朋友圈
			onShareTimeline(){
				
			}
		},
		computed: {
			...mapState({
				tabbarList: (state) => state.tabbar.tabbarList || [],
				componyInfo: (state) => state.aboutUs.componyInfo || {},
			}),
		}
	}
</script>

<style lang="scss" scoped>
	.wxImg {
		width: 100%;
		height: 100%;
		position: fixed;
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%);
	}

	.main {
		// position: absolute;
		width: 100%;
		min-height: 100vh;
		background-repeat: no-repeat;
		background-size: cover;
		// 背景图不随页面滚动而滚动
		background-attachment: fixed;
		padding-top: 30vh;
		// 隐藏背景图
		background-position:-9999px -9999px;
		.bgc {
			width: 100%;
			height: 100%;
		}

		.bottomBox {
			width: 90%;
			padding: 50rpx 0;
			margin: auto;
			background-color: #fff;
			border-radius: 20rpx;
			opacity: 0.9;
			display: flex;
			flex-direction: column;
			justify-content: space-around;

			.top {
				display: flex;

				.logo {
					width: 120rpx;
					height: 120rpx;
					border-radius: 50%;
					margin: 0 40rpx;

				}

				.top_right {
					display: flex;
					flex-direction: column;
					justify-content: space-around;

					.title {
						font-size: 40rpx;
						font-weight: 700;
					}

					.jieshao {
						font-size: 24rpx;
					}
				}
			}

			.center {
				margin: 20rpx 20rpx;
				font-size: 24rpx;
				color: #999;

			}

			.footer {
				display: flex;
				justify-content: space-around;

				.foot-box {
					display: flex;
					flex-direction: column;
					justify-content: center;
				}
			}
		}

		.compony-ddress {
			width: 90%;
			padding: 50rpx 0;
			margin: auto;
			background-color: #fff;
			border-radius: 20rpx;
			opacity: 0.9;
			display: flex;
			flex-direction: column;
			justify-content: space-around;

			.address {
				display: flex;
				// justify-content: center;
				align-items: center;
				padding: 10rpx 20rpx;

				u-image {
					margin-right: 10rpx;
				}
			}
		}
	}
// 解决iOS背景固定失效的问题
	.main::before {
		content: "";
		position: fixed;
		z-index: -1;
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		background-image: inherit;
		-webkit-background-size: cover !important;
		-o-background-size: cover;
		background-size: cover !important;
	}
	
	.mask-image{
		width: 750rpx;
		height: 100vh;
	}
</style>